package com.ddwanglife.jvm;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/**
 安装BTrace插件，在应用程序面板中右击要调试的程序，会出现"Trace Application..."菜单，点击将进入BTrace面板。
 @OnMethod(
    clazz = "BTraceTest",
    method = "add",
    location = @Location(Kind.RETURN)
 )
 public static void func(@Self BTraceTest instance,int a,int b,@Return int result){
     println("调用堆栈:");
     jstack();
     println(strcat("方法参数A:",str(a)));
     println(strcat("方法参数B:",str(b)));
     println(strcat("方法结果:",str(result)));
 }
 */
public class BTraceTest {
    public int add(int a,int b){
        return a+b;
    }
    public static void main(String[] args) throws IOException {
        BTraceTest test = new BTraceTest();
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        for(int i=0;i<10;i++){
            reader.readLine();
            int a = (int) Math.round(Math.random()*1000);
            int b = (int) Math.round(Math.random()*1000);
            System.out.println(test.add(a,b));
        }
    }
}
